ss = input().split()[0]
if(ss.isalpha()):
	if(ss.isupper()):
		ss = ss.lower()
	else:
		ss = ss.upper()
	print(ss)
else:
	print("Input Error")